Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: poll many blocks #277

Merged
merged 15 commits into from
Jan 17, 2025
Merged

feat: poll many blocks #277

merged 15 commits into from
Jan 17, 2025

Conversation

Lazar955
Copy link
Member

@Lazar955 Lazar955 commented Jan 10, 2025

closes #264

}

if failedCycles > maxFailedCycles {
cp.logger.Fatal("the poller has reached the max failed cycles, exiting")
}
select {
case <-time.After(cp.cfg.PollInterval):
case <-ticker.C:
Copy link
Member Author

@Lazar955 Lazar955 Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use a ticker for long-running loops, as time.After creates a new instance every iteration that needs to be garbage-collected

return cp.nextHeight
}

func (cp *ChainPoller) setNextHeight(height uint64) {
cp.mu.Lock()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we run the unit tests with -race, we have a race condition, need a mutex for this

@Lazar955 Lazar955 requested a review from gitferry January 15, 2025 13:23
@Lazar955 Lazar955 marked this pull request as ready for review January 15, 2025 13:23
Copy link
Member

@gitferry gitferry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Two comments:

finality-provider/service/chain_poller.go Outdated Show resolved Hide resolved
finality-provider/service/chain_poller.go Show resolved Hide resolved
@Lazar955 Lazar955 requested a review from gitferry January 16, 2025 13:55
Copy link
Member

@gitferry gitferry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

finality-provider/config/poller.go Show resolved Hide resolved
@Lazar955 Lazar955 merged commit d506aa9 into main Jan 17, 2025
12 checks passed
@Lazar955 Lazar955 deleted the lazar/improve-poller branch January 17, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve poller to poll batch of blocks at once
2 participants